﻿Create PROCEDURE [dbo].[proc_Roles_FAdmin_GetList]
	(
		@UserName nvarchar(50)
	)
AS
	
	Declare @UserId int,@Count int
	select @UserId=UserId from aspnet_users where username=@UserName
	Set @Count=(select count(id) from aspnet_usersinroles where userid=@UserId and roleid=18)--18 总经理
	If(@Count = 0)
		Begin
			Select
			RoleId,
			RoleName,
			Description,
			Sort,
			FAdminFlg
			From aspnet_Roles  Order by Sort
		End
	else
		Begin
			Select
			RoleId,
			RoleName,
			Description,
			Sort,
			FAdminFlg
			From aspnet_Roles Where FAdminFlg=1 Order by Sort
		End
	
	RETURN
